﻿<Views:ViewPage x:Class="PhoneGuitarTab.UI.Views.StartupView"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:Command="clr-namespace:PhoneCore.Framework.Views.Commands;assembly=PhoneGuitarTab.Core"
               xmlns:Controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
               xmlns:Infrastructure="clr-namespace:PhoneGuitarTab.UI.Infrastructure"
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
               xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
               x:Name="root"
               xmlns:Views="clr-namespace:PhoneGuitarTab.Core.Views;assembly=PhoneGuitarTab.Core" 
               xmlns:custom="clr-namespace:PhoneGuitarTab.Controls;assembly=PhoneGuitarTab.Controls"
               xmlns:panaromaItems="clr-namespace:PhoneGuitarTab.UI.Views.PanaromaItems"
               xmlns:ui="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"               
               DataContext="{Binding Startup,  Source={StaticResource Locator}}"
               FontFamily="{StaticResource PhoneFontFamilySemiBold}"
               FontSize="{StaticResource PhoneFontSizeNormal}"
               Foreground="{StaticResource PhoneForegroundBrush}"
               Orientation="Portrait"
               SupportedOrientations="Portrait"
               d:DesignHeight="800"
               d:DesignWidth="480"
               shell:SystemTray.IsVisible="False"
               mc:Ignorable="d"
               BackKeyPress="StartupView_BackKeyPress"
               Style="{StaticResource TransitionPageStyle}">
  

    <Views:ViewPage.Resources>
        <custom:BindableApplicationBar x:Key="TabsAppBar"  Mode="Default" BindableOpacity="0.6">
            <custom:BindableApplicationBarButton  Command="{Binding GoTo}"
                                                     CommandParameter="MainSearch"                                      
                                                     IconUri="/Images/light/appbar.feature.search.rest.png"
                                                     Text="{Binding Path=LocalizedResources.Startup_TabSearch, Source={StaticResource LocalizedStrings}}">
            </custom:BindableApplicationBarButton>
            <custom:BindableApplicationBarButton 
                                                     Command="{Binding Collection.SetIsSelectionEnabled, Source={StaticResource Locator}}"
                                                     CommandParameter="true"
                                                     IconUri="/Images/light/multi.png"
                                                     Text="{Binding Path=LocalizedResources.Startup_Select, Source={StaticResource LocalizedStrings}}" />            
            <custom:BindableApplicationBar.MenuItems>
                <custom:BindableApplicationBarMenuItem
                                                     Command="{Binding GoTo}"
                                                     CommandParameter="Synchronize"
                                                     Text="{Binding Path=LocalizedResources.Startup_Syncronize, Source={StaticResource LocalizedStrings}}" />              
                <custom:BindableApplicationBarMenuItem 
                                                     Command="{Binding GoTo}"
                                                     CommandParameter="About"
                                                     Text="{Binding Path=LocalizedResources.Startup_About, Source={StaticResource LocalizedStrings}}" />             
            </custom:BindableApplicationBar.MenuItems>
        </custom:BindableApplicationBar>
        <custom:BindableApplicationBar x:Key="TabsAppBarAdEnabled"  Mode="Default" BindableOpacity="0.6">
            <custom:BindableApplicationBarButton  Command="{Binding GoTo}"
                                                     CommandParameter="MainSearch"                                      
                                                     IconUri="/Images/light/appbar.feature.search.rest.png"
                                                     Text="{Binding Path=LocalizedResources.Startup_TabSearch, Source={StaticResource LocalizedStrings}}">
            </custom:BindableApplicationBarButton>
            <custom:BindableApplicationBarButton 
                                                     Command="{Binding Collection.SetIsSelectionEnabled, Source={StaticResource Locator}}"
                                                     CommandParameter="true"
                                                     IconUri="/Images/light/multi.png"
                                                     Text="{Binding Path=LocalizedResources.Startup_Select, Source={StaticResource LocalizedStrings}}" />
            <custom:BindableApplicationBar.MenuItems>
                <custom:BindableApplicationBarMenuItem
                                                     Command="{Binding GoTo}"
                                                     CommandParameter="Synchronize"
                                                     Text="{Binding Path=LocalizedResources.Startup_Syncronize, Source={StaticResource LocalizedStrings}}" />
                <custom:BindableApplicationBarMenuItem 
                                                     Command="{Binding GoTo}"
                                                     CommandParameter="About"
                                                     Text="{Binding Path=LocalizedResources.Startup_About, Source={StaticResource LocalizedStrings}}" />
                <custom:BindableApplicationBarMenuItem 
                                                     Command="{Binding PurchasePro}"                                                   
                                                     Text="{Binding Path=LocalizedResources.Startup_RemoveAds, Source={StaticResource LocalizedStrings}}" />
            </custom:BindableApplicationBar.MenuItems>
        </custom:BindableApplicationBar>
        <custom:BindableApplicationBar x:Key="Default" Mode="Default" BindableOpacity="0.6">
            <custom:BindableApplicationBarButton  Command="{Binding GoTo}"
                                                     CommandParameter="MainSearch"                                      
                                                     IconUri="/Images/light/appbar.feature.search.rest.png"
                                                     Text="{Binding Path=LocalizedResources.Startup_TabSearch, Source={StaticResource LocalizedStrings}}">
            </custom:BindableApplicationBarButton>          
            <custom:BindableApplicationBar.MenuItems>
                <custom:BindableApplicationBarMenuItem 
                                                     Command="{Binding Review}"                                                   
                                                     Text="{Binding Path=LocalizedResources.Startup_RateApp, Source={StaticResource LocalizedStrings}}" />
                <custom:BindableApplicationBarMenuItem  
                                                     Command="{Binding GoTo}"
                                                     CommandParameter="About"
                                                     Text="{Binding Path=LocalizedResources.Startup_About, Source={StaticResource LocalizedStrings}}" />
            </custom:BindableApplicationBar.MenuItems>

        </custom:BindableApplicationBar>
        <custom:BindableApplicationBar x:Key="DefaultAdEnabled" Mode="Default" BindableOpacity="0.6">
            <custom:BindableApplicationBarButton  Command="{Binding GoTo}"
                                                     CommandParameter="MainSearch"                                      
                                                     IconUri="/Images/light/appbar.feature.search.rest.png"
                                                     Text="{Binding Path=LocalizedResources.Startup_TabSearch, Source={StaticResource LocalizedStrings}}">
            </custom:BindableApplicationBarButton>
            <custom:BindableApplicationBar.MenuItems>
                <custom:BindableApplicationBarMenuItem 
                                                     Command="{Binding Review}"                                                   
                                                     Text="{Binding Path=LocalizedResources.Startup_RateApp, Source={StaticResource LocalizedStrings}}" />
                <custom:BindableApplicationBarMenuItem  
                                                     Command="{Binding GoTo}"
                                                     CommandParameter="About"
                                                     Text="{Binding Path=LocalizedResources.Startup_About, Source={StaticResource LocalizedStrings}}" />
                <custom:BindableApplicationBarMenuItem 
                                                     Command="{Binding PurchasePro}"                                                   
                                                     Text="{Binding Path=LocalizedResources.Startup_RemoveAds, Source={StaticResource LocalizedStrings}}" />
            </custom:BindableApplicationBar.MenuItems>

        </custom:BindableApplicationBar>

        <custom:BindableApplicationBar x:Key="MultiSelectAppBar" Mode="Default"  BindableOpacity="0.6">
            <custom:BindableApplicationBarButton
                                                    Command="{Binding Collection.RemoveTabs, Source={StaticResource Locator}}"
                                                     IconUri="/Images/light/delete.png"
                                                     Text="{Binding Path=LocalizedResources.Startup_Delete, Source={StaticResource LocalizedStrings}}">
            </custom:BindableApplicationBarButton>
        </custom:BindableApplicationBar>
        <Infrastructure:ImageUrlToUriConverter x:Key="ImageUrlToUriConverter"/>
        
        <Storyboard x:Name="OpacityFadeOut">
            <DoubleAnimation Storyboard.TargetName="MainPanorama"
        		Storyboard.TargetProperty="(UIElement.Background).(Opacity)" From="0.5"
        		To="0.2" Duration="0:0:1"/>
        </Storyboard>

        <Storyboard x:Name="OpacityFadeIn">
            <DoubleAnimation Storyboard.TargetName="MainPanorama"
        		Storyboard.TargetProperty="(UIElement.Background).(Opacity)" From="0.2"
        		To="0.5" Duration="0:0:1"/>
        </Storyboard>


    </Views:ViewPage.Resources>

        <Grid x:Name="LayoutRoot">
        <Controls:Panorama Name="MainPanorama" Title="Phone Guitar Tab" TitleTemplate="{StaticResource EmptyTitleTemplate}" SelectionChanged="MainPanorama_SelectionChanged" Loaded="MainPanorama_OnLoaded">        
            <panaromaItems:Tabs />
            <panaromaItems:Bands />
            <panaromaItems:Discover />
            <panaromaItems:History />            
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="SelectionChanged">
                    <Command:ExecuteCommandAction Command="{Binding Collection.RefreshData, Source={StaticResource Locator}}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <Controls:Panorama.Background>
                <ImageBrush Stretch="UniformToFill"  Opacity="0.5" AlignmentX="Center" AlignmentY="Center">
                    <ImageBrush.ImageSource>
                        <BitmapImage UriSource="{Binding Startup.BackGroundImage, Source={StaticResource Locator}, Converter={StaticResource ImageUrlToUriConverter}}" CreateOptions="BackgroundCreation" />
                    </ImageBrush.ImageSource>
                </ImageBrush>
            </Controls:Panorama.Background>
        </Controls:Panorama>
            <Grid Name="AdContainer">
            <ui:AdControl ApplicationId="398538e9-3217-46b2-90d2-58bd4208d95f" AdUnitId="10865827" HorizontalAlignment="Center" Height="80" VerticalAlignment="Top" Width="480" Visibility="{Binding IsAdEnabled, Converter={StaticResource boolVisibility}}" Margin="0,84,0,0" />
            </Grid>


    </Grid>

    
</Views:ViewPage>